home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume24 / psroff3.0 / part07 < prev    next >
Encoding:
Internet Message Format  |  1991-10-09  |  55.5 KB

  1. Subject:  v24i102:  psroff, Troff to PostScript filter, Part07/19
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4.  
  5. Submitted-by: Chris Lewis <clewis@ferret.ocunix.on.ca>
  6. Posting-number: Volume 24, Issue 102
  7. Archive-name: psroff3.o/part07
  8.  
  9. #! /bin/sh
  10. # This is a shell archive.  Remove anything before this line, then feed it
  11. # into a shell via "sh file" or similar.  To overwrite existing files,
  12. # type "sh file -c".
  13. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  14. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  15. # Contents:  Makefile fonts.lj/S.22.pk.UU utils.c utils/psxlate.c
  16. # Wrapped by clewis@ecicrl on Fri Apr  5 20:55:59 1991
  17. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  18. echo If this archive is complete, you will see the following message:
  19. echo '          "shar: End of archive 7 (of 19)."'
  20. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  21.   echo shar: Will not clobber existing file \"'Makefile'\"
  22. else
  23.   echo shar: Extracting \"'Makefile'\" \(13261 characters\)
  24.   sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  25. X#    Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  26. X#        All Rights Reserved
  27. X#
  28. X#    See the LICENSE file for a full description of the restrictions
  29. X#    under which this software is provided.
  30. X#
  31. X#    This makefile requires System V compatible "make".  *Not* V7
  32. X#    vanilla BSD or Ultrix or Sun.  Most modern systems will have
  33. X#    a copy of the SV one somewhere (eg: .../s5bin/make).
  34. X#
  35. X#    Function: Upper level makefile; configuration options.
  36. X#
  37. X#
  38. X#ident  "@(#)Makefile: 2.16 Copyright 91/04/02 17:02:22 Chris Lewis"
  39. X
  40. X#    Use s5make on Ultrix!
  41. XMAKE    = make
  42. X
  43. X#    Only uncomment the following braindamage if your MAKE doesn't
  44. X#    understand "include".
  45. X#MAKE    = sed -e '/include/r ../makeincl' -e '/include/d' Makefile | make -f - $(MAKEFLAGS)
  46. X
  47. X#    Set to where you want the user-interfaces to go.  /usr/lbin
  48. X#    is also common.  /usr/bin if you don't have a specific place
  49. X#    for non-standard programs.
  50. XBINDIR    = /usr/local/bin
  51. X
  52. X#    Testing type (default postscript (ps)):
  53. X#    Use lj for laserjet.
  54. XTTYPE    = ps
  55. X
  56. X#    Libraries for Troff2 internals, created if it doesn't exist.
  57. X#    This *must* be a directory all by itself with no other stuff
  58. X#    in it.  This should be suitable for everybody except networked
  59. X#    systems where you may want to put this on a common area (one
  60. X#    per platform type (eg: Sun 3 vs. Sun 4)
  61. XLIBDIR    = /usr/lib/troff2
  62. X
  63. X#    Directory for Laserjet fonts.  Don't change this unless you
  64. X#    really have to.
  65. XLJF    = $(LIBDIR)/lib/lj
  66. X
  67. X#    nroff/troff macro directory for tmac.t2.  Change this only
  68. X#    if you insist on keeping /usr/lib/tmac "virginal".
  69. XT2DIR    = /usr/lib/tmac
  70. X
  71. X#    Where your real macros are - leave this alone unless your UNIX
  72. X#    is really wierd.
  73. XRTMACDIR = /usr/lib/tmac
  74. X
  75. X#    upper level man directory, with subdirectories man1, man2 etc.
  76. X#    Could be /usr/man/mann, /usr/man/manl, /usr/man/man1, /usr/man/l_man/man1
  77. XMANDIR    = /usr/man/mann
  78. X#    Desired extension for man page.  Often the last letter of MANDIR.
  79. X#    or 1L, or simply 1.
  80. XMANEXT    = n
  81. X
  82. X#    Change this at your peril - your troff *must* support -F!
  83. X#    (font width files (ft??) are placed under FONTDIR/<width>/ft??)
  84. X#    (see lib/psrofflib.S).  Will NOT clash with anything already there.
  85. XFONTDIR    = /usr/lib/font
  86. X
  87. X#    Set this to -lc_s if you have 386/ix style shared libraries and you
  88. X#    wish to use them.  Don't know about any other system's shared libraries.
  89. XLIBFLAGS =
  90. X
  91. X#    Bourne shell.  *All* Bourne shells with the exception of extremely
  92. X#    braindamaged ones (such as Ultrix or vanilla BSD) will work fine.
  93. X#    Ultrix/Dynix may need the ... s5bin/sh one.  Korn or bash
  94. X#    *should* work just fine, but I've never tested 'em.
  95. X#
  96. X#    This is also here for make, but if you have SHELL defined in your
  97. X#    *own* environment, you can't trust this to work anyways.
  98. X#
  99. XSHELL    =    /bin/sh
  100. X
  101. X#    Try "make testbug"  If make stops, uncomment IGNORESH and
  102. X#    try "make testbug" again.  If it still stops, complain to your
  103. X#    vendor - your shell is BADLY broken.
  104. X#IGNORESH = set +e ;
  105. X
  106. X#    How to ensure that shell scripts use the *right* shell.
  107. X#    "#! /bin/sh" may work for you (BSDish).  ": /bin/sh" may work
  108. X#    for you (Xenix or System V).
  109. X#
  110. X#    Frankly, none of this crap is necessary on a sane O/S.
  111. X#    (Even Xenix gets this right for crying out loud!  But *noooo*
  112. X#    Not Ultrix or Sun or Dynix BSD universe....)
  113. X#
  114. X#    ": /usr/bin/sh5" works for Ultrix.  "#! /bin/sh" for pure BSD.
  115. X#    Do not use $(SHELL) in this line because if your environment has
  116. X#    SHELL defined, it may *override* the above SHELL definition.
  117. X#
  118. X#    System V/Xenix usually:
  119. XSTARTSHELL = : /bin/sh
  120. X#    #! something (tr wierdness is to get "#" into it)
  121. XSTARTSHELL = `echo 'X! /bin/sh' | tr X '\043'`
  122. X
  123. X#    Whether you need "cc -c"'d font width tables for troff.
  124. X#    Don't set this non-null unless nothing else works.
  125. X#    I know of no machine needing it.  See TROUBLE file.
  126. XCOMPILE    =
  127. X
  128. X#    Compile flags needed to compile things on your machine.
  129. X#    Usually just -O.  May need gcc stuff.
  130. X#
  131. XCCFLAGS = -O
  132. X
  133. X#    If you're using gcc or something else, change this:
  134. XCC    = cc
  135. X
  136. X#    Do not comment any of the following out.  If you aren't going
  137. X#    to use TeX PK fonts with HP Laserjet output, just NEVER execute
  138. X#    makebuildljfonts.
  139. X#
  140. X#    If you have Rick Richardson's sfp2pk, set it's full path here:
  141. X#    Only of interest for LJ/buildfonts.  If you don't have sfp2pk,
  142. X#    leave this alone, the code won't try to run it.
  143. XSFP2PK    = /usr4/public/bin/sfp2pk
  144. X#    If you have TeX fonts onboard, list the directories that
  145. X#    contain them.  Only of interest for LJ/buildfonts.
  146. X#    You can always set this to "/", it'll just take a long time, but
  147. X#    it will find ALL PK's on your system.
  148. XPKFONTS    = /usr/lib/font/devjet /usr5/texfonts/fonts
  149. X#    Where you want to build fonts, set this to the name of the
  150. X#    directory where you want to make them.  Caution: this could be
  151. X#    enormous...  (5000+ blocks)
  152. XNEWFONTS = /tmp/newfonts
  153. X#    If you are going to be working with ditroff, set this to the
  154. X#    path to the makedev (DWB) or mkfont (PD via comp.sources.unix) program.
  155. X#    If this doesn't point at an executable program, nothing will happen.
  156. X#    A make install in the widths directory will go through the psrofflib
  157. X#    file, looking for each configuration requiring ditroff, and install
  158. X#    the needed widths in the proper directory.  This will NOT overwrite
  159. X#    files not created by this process.
  160. XMAKEDEV    = /u/clewis/src/mkfont/mkfont
  161. X
  162. X#    Dinna touch from here on
  163. X
  164. X.SUFFIXES: .S .S~
  165. X
  166. X.S~:
  167. X    @rm -f $@
  168. X    $(GET) -p $(GFLAGS) $< | ./sedscript > $@
  169. X    @chmod 444 $@
  170. X
  171. X.S~.S:
  172. X    @rm -f $@
  173. X    $(GET) -p $(GFLAGS) $< > $@
  174. X    @chmod 444 $@
  175. X
  176. X.S:
  177. X    rm -f $@
  178. X    ./sedscript < $@.S > $@
  179. X    @chmod 444 $@
  180. X
  181. X#    Main stuff:
  182. X
  183. XMAIN    = troff2.o opt.o utils.o t2conf.o cattab.o debug.o
  184. X
  185. X#    Drivers:
  186. X
  187. XBACKENDS = lj.o pk.o pkc.o ps.o dt.o dit.o
  188. X
  189. XDEFINES    = '-DLIBDIR="$(LIBDIR)/lib"' '-DFONTDIR="$(FONTDIR)"'\
  190. X    '-DLJF="$(LJF)"' $(CCFLAGS)
  191. X
  192. X#    Creation of sedscript for parameterization.
  193. X
  194. XSEDSCRIPT =    "sed -e 's;%%LIBDIR%%;$(LIBDIR);g' \
  195. X             -e 's;%%LJF%%;$(LJF);g' \
  196. X             -e 's;%%STARTSHELL%%;'\"$(STARTSHELL)\"';g' \
  197. X             -e 's;%%COMPILE%%;$(COMPILE);g' \
  198. X             -e 's;%%FONTDIR%%;$(FONTDIR);g' \
  199. X             -e 's;%%MANDIR%%;$(MANDIR);g' \
  200. X             -e 's;%%MANEXT%%;$(MANEXT);g' \
  201. X             -e 's;%%CCFLAGS%%;$(CCFLAGS);' \
  202. X             -e 's;%%CC%%;$(CC);' \
  203. X             -e 's;%%LIBFLAGS%%;$(LIBFLAGS);' \
  204. X             -e 's;%%SFP2PK%%;$(SFP2PK);' \
  205. X             -e 's;%%PKFONTS%%;$(PKFONTS);' \
  206. X             -e 's;%%NEWFONTS%%;$(NEWFONTS);' \
  207. X             -e 's;%%T2DIR%%;$(T2DIR);' \
  208. X             -e 's;%%MAKEDEV%%;$(MAKEDEV);' \
  209. X             -e 's^%%IGNORESH%%^$(IGNORESH)^' \
  210. X             -e 's;%%RTMACDIR%%;$(RTMACDIR);g'"
  211. X
  212. XCFLAGS    = $(DEFINES)
  213. X
  214. Xall:    troff2ps subst.done makeincl psroff README TROUBLE LASERFONTS \
  215. X    MISC DITROFF INSTALL LICENSE LJIII submakes
  216. X
  217. Xsubst.done:    sedscript
  218. X    rm -f psroff makeincl
  219. X    touch subst.done
  220. X
  221. Xsubmakes:
  222. X    cd adapters ; $(MAKE) all
  223. X    cd lib ; $(MAKE) all
  224. X    cd man ; $(MAKE) all
  225. X    cd utils ; $(MAKE) all
  226. X    cd widths ; $(MAKE) all
  227. X    cd tests ; $(MAKE) all
  228. X
  229. Xpsroff:    psroff.S sedscript
  230. X    @echo "Extracting $@ with variable substitutions"
  231. X    @rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@
  232. X
  233. Xmakeincl:    makeincl.S sedscript
  234. X    @echo "Extracting $@ with variable substitutions"
  235. X    @rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@
  236. X
  237. Xaudit:    audit.S sedscript
  238. X    @echo "Extracting $@ with variable substitutions"
  239. X    @rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@
  240. X
  241. Xunpackljfonts:
  242. X    @ $(IGNORESH) find . -name '*.UU' -print | \
  243. X    while read i ; \
  244. X    do \
  245. X        ft=`echo $$i | sed -e 's/.UU//'` ; \
  246. X        if [ -s $$ft ] ; \
  247. X        then \
  248. X        echo "Removing $$i" ; \
  249. X        rm -f $$i ; \
  250. X        else \
  251. X        rm -f $$ft ; \
  252. X        echo "uudecoding $$i -> $$ft" ; \
  253. X        uudecode < $$i ; \
  254. X        if [ ! -s $$ft ] ; \
  255. X        then \
  256. X            echo "Whoops - uudecode failed on $$i - bad path?" ; \
  257. X            exit 1 ; \
  258. X        else \
  259. X            rm $$i ; \
  260. X        fi ; \
  261. X        fi ; \
  262. X    done
  263. X
  264. Xbuildljfonts:    unpackljfonts
  265. X    make troff2ps makeincl
  266. X    cd lib ; make lj.fonts lj.lib
  267. X    cd utils ; make buildfonts
  268. X
  269. Xinstallljfonts:
  270. X    test -d $(LIBDIR) || mkdir $(LIBDIR)
  271. X    test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib
  272. X    test -d $(LIBDIR)/lib/lj || mkdir $(LIBDIR)/lib/lj
  273. X    $(IGNORESH) files=`echo fonts.lj/*.pk` ; \
  274. X    if [ "$$files" != 'fonts.lj/*.pk' ] ; \
  275. X    then \
  276. X        cp fonts.lj/*.pk $(LJF) ; \
  277. X        chmod 644 $(LJF)/* ; \
  278. X    fi
  279. X    $(IGNORESH) files=`echo fonts.lj/*.sfp` ; \
  280. X    if [ "$$files" != 'fonts.lj/*.sfp' ] ; \
  281. X    then \
  282. X        cp fonts.lj/*.sfp $(LJF) ; \
  283. X        chmod 644 $(LJF)/* ; \
  284. X    fi
  285. X    @echo "don't panic if the next line dies"
  286. X    $(IGNORESH) test -z "$(PKFONTS)" -o ! -d "$(NEWFONTS)" \
  287. X        || cp $(NEWFONTS)/* $(LJF)
  288. X
  289. Xregister:
  290. X    make troff2ps makeincl
  291. X    cd lib ; make lj.fonts lj.lib
  292. X    cd widths ; make ljwidths widths
  293. X    @echo "Now su to root and type 'make installwidths'"
  294. X
  295. Xinstallwidths:    makeincl
  296. X    cd widths; $(MAKE) installwidths
  297. X
  298. Xinstall:    makeincl
  299. X    test -d $(BINDIR) || mkdir $(BINDIR)
  300. X    test -d $(MANDIR) || echo "No MANDIR directory.  Have you got MANDIR right?"
  301. X    test -d $(LIBDIR) || mkdir $(LIBDIR)
  302. X    test -d $(LIBDIR)/adapters || mkdir $(LIBDIR)/adapters
  303. X    test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib
  304. X    test -d $(RTMACDIR) || mkdir $(RTMACDIR)
  305. X    test -d $(FONTDIR) || mkdir $(FONTDIR)
  306. X    rm -f $(BINDIR)/psroff.old
  307. X    -cp $(BINDIR)/psroff $(BINDIR)/psroff.old
  308. X    cp psroff $(BINDIR)/psroff
  309. X    rm -f $(LIBDIR)/troff2ps.old
  310. X    -cp $(LIBDIR)/troff2ps $(LIBDIR)/troff2ps.old
  311. X    cp troff2ps $(LIBDIR)/troff2ps
  312. X    chmod 755 $(LIBDIR)/troff2ps $(BINDIR)/psroff
  313. X    cd lib ; $(MAKE) install
  314. X    cd adapters ; $(MAKE) install
  315. X    cd man ; $(MAKE) install
  316. X    cd utils ; $(MAKE) install
  317. X    cd widths; $(MAKE) install
  318. X
  319. Xtroff2ps:    $(MAIN) $(BACKENDS)
  320. X    $(CC) $(CFLAGS) -o troff2ps $(MAIN) $(BACKENDS) $(LIBFLAGS)
  321. X
  322. X#    The following is commented out because make has a bug in that
  323. X#    even if you don't want to make lint, it insists on making
  324. X#    the .c's from the SCCS files.  Dumb stupid....
  325. X#lint:    $(MAIN:.o=.c) $(BACKENDS:.o=.c)
  326. X#    lint -p $(CFLAGS) $(MAIN:.o=.c) $(BACKENDS:.o=.c) > output.lint
  327. X
  328. X#    Drivers include dependencies - add to this list if you're adding
  329. X#    drivers.
  330. Xdit.o:    defs.h
  331. Xt2conf.o:    defs.h ps.h lj.h dt.h
  332. Xps.o:    defs.h ps.h
  333. Xdt.o:    defs.h dt.h
  334. Xlj.o:    defs.h lj.h pkc.h pk.h
  335. X
  336. Xpk.o:    defs.h pk.h pkc.h
  337. Xpkc.o:    defs.h pk.h pkc.h
  338. Xcattab.o:    defs.h pk.h
  339. Xdebug.o:    defs.h pk.h
  340. X
  341. Xtroff2.o utils.o opt.o: defs.h
  342. X
  343. Xsedscript:    Makefile defs.h
  344. X    rm -f sedscript
  345. X    echo $(SEDSCRIPT) \
  346. X        `sed -n -e  \
  347. X        '/T2VERSION/s/^.*\(R[0-9]* PL.*\)".*/-e "s;%%T2VERSION%%;\1;"/p' \
  348. X        defs.h` > T
  349. X    chmod 755 T
  350. X    mv T sedscript
  351. X
  352. X
  353. Xclean:    makeincl
  354. X    rm -f core *.o troff2ps psroff diagnostics audit
  355. X    rm -fr mon.out output.lint TEST* DITTEST AUDITP AUDITP.c
  356. X    rm -fr FONTS
  357. X    cd adapters ; $(MAKE) clean
  358. X    cd man ; $(MAKE) clean
  359. X    cd utils ; $(MAKE) clean
  360. X    cd lib ; $(MAKE) clean
  361. X    cd widths ; $(MAKE) clean
  362. X    cd tests ; $(MAKE) clean
  363. X    rm -f sedscript makeincl subst.done */subst.done
  364. X
  365. X#    Yes, this is a little wierd, but in this way I can figure
  366. X#    out what you are...
  367. XTEST:    Makefile defs.h tests/testtab.m tests/exttab.m makeincl
  368. X    cd lib ; make
  369. X    rm -f TEST1 TEST2
  370. X    PATH=.:$(LIBDIR):$$PATH \
  371. X        troff2ps -V | sed -e 's/^.*- \(.*\)/.ds 2v "\1/' > TEST1
  372. X    echo ".ds pt \"($(TTYPE))" >> TEST1
  373. X    echo ".ds 2d \"`date`" >> TEST1
  374. X    echo ".sp" > TEST2
  375. X    echo ".ps 10" >> TEST2
  376. X    echo ".vs 12p" >> TEST2
  377. X    echo ".ad 1" >> TEST2
  378. X    echo "DEFS.H DEFINITIONS:" >> TEST2
  379. X    sed -n -e '/Edit no more/q' \
  380. X        -e '/T2VERSION/d' \
  381. X        -e '/LIBDIR/d' \
  382. X        -e 's/[     ]*\/\*.*//' \
  383. X        -e '/^.define[     ]*\([^     ]*\)[     ]*\(.*\)$$/s//define \1=\2;/' \
  384. X        -e 's/=;/;/' \
  385. X        -e 's/^define //p' \
  386. X        -e '/^.undef[     ]*\([^     ]*\).*/s//!\1;/p' \
  387. X        defs.h >> TEST2
  388. X    #echo ".br" >> TEST2
  389. X    echo "MAKEFILE DEFINITIONS:" >> TEST2
  390. X    echo "LIBDIR = $(LIBDIR);" >> TEST2
  391. X    echo "LJF = $(LJF);" >> TEST2
  392. X    echo "STARTSHELL = $(STARTSHELL); " >> TEST2
  393. X    echo "SHELL = $(SHELL); " >> TEST2
  394. X    echo "COMPILE = $(COMPILE);" >> TEST2
  395. X    echo "FONTDIR = $(FONTDIR);" >> TEST2
  396. X    echo "MANDIR = $(MANDIR);" >> TEST2
  397. X    echo "CCFLAGS = $(CCFLAGS);" >> TEST2
  398. X    echo "CC = $(CC);" >> TEST2
  399. X    echo "LIBFLAGS = $(LIBFLAGS);" >> TEST2
  400. X    echo "RTMACDIR = $(RTMACDIR);" >> TEST2
  401. X    echo "PKFONTS = $(PKFONTS);" >> TEST2
  402. X    echo "NEWFONTS = $(NEWFONTS);" >> TEST2
  403. X    echo "IGNORESH = $(IGNORESH);" >> TEST2
  404. X    echo "SFP2PK = $(SFP2PK)." >> TEST2
  405. X    echo "TTYPE = $(TTYPE)." >> TEST2
  406. X    @echo "Don't worry if the uname/grep fails"
  407. X    -grep '^trofftype' lib/psrofflib >> TEST2
  408. X    echo "Uname results:" >> TEST2
  409. X    -uname -a >> TEST2
  410. X    cat TEST1 tests/testtab.m TEST2 > TEST
  411. X    rm -f TEST1 TEST2
  412. X
  413. Xtest:    TEST
  414. X    tbl TEST | PATH=:.:$(LIBDIR):$$PATH psroff -T$(TTYPE) $(TFLAGS)
  415. X
  416. XDITTEST:    TEST
  417. X    echo ".bp" >> TEST2
  418. X    echo ".sp |.3i" >> TEST2
  419. X    cat TEST TEST2 tests/exttab.m > DITTEST
  420. X
  421. Xdittest:    DITTEST
  422. X    eqn DITTEST | tbl | PATH=:.:$(LIBDIR):$$PATH psroff -T$(TTYPE) $(TFLAGS)
  423. X
  424. Xcheck:    audit sedscript makeincl
  425. X    cd lib ; $(MAKE)
  426. X    ./audit
  427. X
  428. Xcheckinstall:    audit sedscript makeincl
  429. X    cd lib ; $(MAKE)
  430. X    ./audit install
  431. X
  432. X#    This is how I build a release - don't even try running this...!
  433. Xbuildrelease:    clean unpackljfonts
  434. X    $(IGNORESH) t=`find . -name 'p.*' -print`; \
  435. X    if [ -n "$$t" ] ; \
  436. X    then \
  437. X        echo "files still out: $$t" ; \
  438. X        exit 1 ; \
  439. X    fi
  440. X    make buildfinal
  441. X
  442. Xbuildfinal:
  443. X    make clean
  444. X    t/cleantree
  445. X    t/mkmanifest
  446. X    t/mkkits
  447. X    t/cleantree
  448. X
  449. X#    Impossible file, we hope....
  450. XWF    = /cowsnovskibumsteinpastafazoola/bdkdkdk
  451. Xtestbug:
  452. X    @ $(IGNORESH) if [ -r $(WF) ] ; \
  453. X    then \
  454. X        echo "Bizarre - are you sure you have $(WF)?" ; \
  455. X    else \
  456. X        echo "IGNORESH set correctly" ; \
  457. X    fi
  458. X
  459. Xfixperms:
  460. X    find $(LIBDIR) -type f -exec chmod +r '{}' ';'
  461. X    find $(LIBDIR) $(FONTDIR) -type d -exec chmod +rx '{}' ';'
  462. END_OF_FILE
  463.   if test 13261 -ne `wc -c <'Makefile'`; then
  464.     echo shar: \"'Makefile'\" unpacked with wrong size!
  465.   fi
  466.   # end of 'Makefile'
  467. fi
  468. if test -f 'fonts.lj/S.22.pk.UU' -a "${1}" != "-c" ; then 
  469.   echo shar: Will not clobber existing file \"'fonts.lj/S.22.pk.UU'\"
  470. else
  471.   echo shar: Extracting \"'fonts.lj/S.22.pk.UU'\" \(13015 characters\)
  472.   sed "s/^X//" >'fonts.lj/S.22.pk.UU' <<'END_OF_FILE'
  473. Xtable
  474. X !"#$%&'()*+,-./0123456789:;<=>?
  475. X@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
  476. Xbegin 644 fonts.lj/S.22.pk
  477. XM]UD``7``````````!":N``0FKI"_(0```$9"6_I#U2U?3373337333733373
  478. XM]--=---=---=---=---=/TTUTTTUTTTUTTTUT_3373337333733373]--=--
  479. XM-=-+(;9;$K9+!;1:]K1*\26R6N$ULDK21;)*P76P6T6P2V6N6V6N2W6M6X6L
  480. XM2Y6K6Z]:I+M:E;Q:A+U:=;Y:9+]:5;]:5,%:-<%:-,-:),-:%<-:%,597%64
  481. XMQU=<=73(5ER55,I47+]33,4ES5%,Z@S_C0?2;27434.^L,$D````>&$H]2;$
  482. XMO?O1QMC%S,O2R\?/SL[%TLK`F,+6QZPWN:Q<2L=IC#P\*<M8;'P[C.1UR\*7
  483. XMT45<W"=]-$3/PE?40UT<$WUD)-/!%]="/5Q]DQ36Q=J-?#W&V<'=;:P-UMO`
  484. XMW&W,#;;=P-IMW!V6W,/7C:Q=9!/9Q]4R37<<'30DUG/!T5--1UPL]$33=\+-
  485. XM54T7G"RU=,Z+P\=H7+G"P\.);'K$Q:FWPZQ];"B<#*TL7.SL_'R]++S,78QM
  486. XM&]^\0)`\)0```%M)/?4SNAVWUYU:'3XJ/1I='BH].AU9UWVQ`#H-T0H1W0`Z
  487. XM`=M]>=6AT^*CT:71XJ/3H=6==]L;H+"A)@```%](*/4FPKVIO%T\&LG.PXS<
  488. XMK%?/R*PI7$Q)Q'P,'"C%;$P,!\9<?`I\=,JX;(3,MFR4S;1LE,^R;*30L5RS
  489. XMTL3*33PLM-/!S#U<#,/6O,/7K,/8K+/8O*/8P,D]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  553. XM.6R#CWR#?B?)-N-\DW;)-_?)-_?(.6R"KVQSIL8[;&+!7%/!7%+#7#+%3"/&
  554. XM3`/(2CRE8\W`T7R`P$!E````)1XJ_"C6K4T='2T(V&V6VFVFVFVFVGVFVGVF
  555. XMVGVFVGVMMMQ-Q>1]KC;<7<]MSUW?7=7=33.%Q+5UT='6BK!U9@```"@G5/Q`
  556. XMS.8MDBG/P<Q9+*,<#)1)R3USUSUSUSUSUSUSU_/7/7/737/737/7/737/7]-
  557. XM;TUSU^)-;C36]=;C37Y%UFUEUFU7U7U)TZTL#0PL[$S,7,Q<S$SL+0P-*=2-
  558. XM5M;C76]-<\LJ3,*3SC5-"M-L0+!G9P```"XI/?TI=<1\"+P))3E&1R9'*D4G
  559. XM5#M4)U,\!B*&(L)2*&$L-2*(Q%\2E\51*6Q8E\6/EL9K;&;CIL9JXVQFKC;&
  560. XM:N-L9JXVQFKC;&:FQFP%QFP3QVUVUN-M;C;6XVUN)M==D\'`EF@````K)4/]
  561. XM0=M0$9W44]M'/9.4UTI-5+343$TUQ=%=!=!=%=!=%K72:FTFI=-I;3:5U&^&
  562. XMU&]VU69]5F;6;U?5=6UG1]9T?696UG3B?6<^(!1'UG/B?6='UF7VUG1]9E]]
  563. XM5U?59FU7;VU6?VU&AM-I;36FTFM=)<71;%T5T%T%T5T$TTQ-1+752DUDE-@X
  564. XM/;-4W:`07;#`.VD````A%ROZ*;/674]M/C;3XVT^)M/C;3XFT^)M/VU&T1XA
  565. XM;1C]$A;0(ET2)=`C7"1;)5HG2#DV2ZT7P,!\:@```#4L*_LIPP&UUET6TYT&
  566. XMTJQM$QC&T#*,;"2,:R9L:R@]%I/=:#WF<M]G(!!F(!%E(!)C,!)C,!-A,!6P
  567. XM%-3=8\VFB=AK?7;0;5;2;4]M-M-M-K'C-M1J(FU5HC]M1J(VU5DC;662-M98
  568. XM)&UT@D;71R1ME$-EVI@]U8"P@6L````V+$+[0,!MJ-M]MMI]IMKWVFVO?:;:
  569. XM]]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?CEL=Y]L=Z;':VQGKVQVOVQFML9L!\5<%\1<)\-L&,-<)A+!7#8BM,
  586. XM5B*5Q60U;&9;R&=LMM?C;7XVU^-M?B;87:/:L&QR````-#`J_2C(S\;3P]7!
  587. XMU\#7P(>,Q[;+;";);$7(;%;&;&;&7(7%7)7$;);#7*;";*;"7+;!;+;!;+7!
  588. XMXVRVP.)LML'VRFPFREP_;)7%7(7&7'7'7'3)3&3*7$3,3#3.3!302ETE9=;`
  589. XMVGTPL$9S````*"LJ_BB].M:-=]AMAEP"RTP3RDPCRBQ"RBQ#R3Q#R2Q3R"QC
  590. XMR"Q3W//;XDVN--I=KTVN)=GB79]MGUV>)MAMI=L\\,!U=````#(L*_TII=LZ
  591. XMC96#0]=V)DU84G74A"A=5S*6U6,I;64BIM92*EV$$J;802IM@Q*VV#'RIMD\
  592. XM;://;:+/;;+&VBSVVRQMHL]MLL]MHM!=HM!MHM#VV2T6V"T_77+4;5+674+7
  593. XM73+971+;6SW6=`$-`!6-8+"T=0```#<N5/M`U1`0XRW^,M_C+?XRW^,M_RW)
  594. XMU<30<B1<Q6)ER%@H3&62E,-:*TP5LK6UP"P$I<$L!87!+"5FP2PE9<(L)57#
  595. XM+"5&PBPV-<,L-B;#+#8EQ"PV\6PRQ,#\0L-A]L,L1A;#+#8EQ"PV+UPRPV-<
  596. XM,L-47#+"55PBPF5L$L)77!+!6%P2P%I,`L!;6RM<%+*EPTHI7%2"A<A6)ES&
  597. XM,C;0Q-6=SB+?XRW^,M_C+?XBU+"@=@```#HR/?TIAMZ]05-&TB0G;0)2=\\D
  598. XM*7S24I?,+&;++'?)+);(+*]\8LQL4LU\,LY\(M!L$M%[+2>BU&HM1X+5=RUV
  599. XM8MAE+9]S+;8BW)W8W_8!#W`0;??>G<(7VR-MKR1]@F;7)VUBA]0I?3*VTO+`
  600. XM?0+";/+#?-+$?,+&;++'?)+(?)+)?'+*?&+,>18LUY)"SV@D+19B0M-D)AU*
  601. XMWG?`RW<````\-E3]0`&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]-Y=[B3>7>]-Y?WDWR$)"O?P```%M)0/4]I*"OH*^FJ::JJZ.K
  618. XMIJZAKJ.Q>QH:"*%:&*"8I).:2'>H@8J'9JNCJV5JVAK61:^:]3:P>P8O6Q>Q
  619. XM46LELJ'[-;.@M#M*#DU:'3;Q734FT6-=%4]L]E;-9_;+:6R6H6QVHGQ7HWPW
  620. XMI7P7IWOWJ7O7JXN8K8MXKXM8L9L9M(KXMXK8N9J9O(IXOYHYP9H9Q(F,>'C*
  621. XM=7S7-\]C;186T_H=6=?WV?7;.Y"P.*$```!!)T[S/,<M@]==7WTYT;S\',Q<
  622. XMEA46QV)2;$<U-\"$5(B&5H.G5\:5G"M;K!7!3@'L5=<\8'`YH@```'AA(?4E
  623. XMQ"UDU5U4U5U5U4U5U5U5U6U&U'TX!M4PRQU<^`T'T6TFTETUTUU$U%TUU$U%
  624. XMU$UBB[`XHP```$$G3O,\QCU^`>7%3!7!JUO"E9QG5Z.&5HB$5(P'-3?$8E)L
  625. XM=A46R<7,P<^]&=/WU5USV2Q@<#ND````>&$A]26++6347434737434737372
  626. XM;2;1?0@,_5(&D=@]5H#3?4;4;5757575357575357536+$"P<:8````N*2[^
  627. XM+A+:78?6G4K3P-%"C/1(S46,Q'C*28R$N,9,"<1,*,-,2,%,:+3(B4R8A,N&
  628. XM3-A$SX)-"!]-*]"!3/@DS81,N&3)B$R(E,:+3$C!3"C#3`G$2XQDF,A'C*18
  629. XMS$2,U"C/P-&M.=1]9=DMH+!QJ````"XI+OXNVBV5UGU)TZT<#/@DS81,R%3*
  630. XMATR(E,:+3$G`3#C"3!C$2XQDF,A(C)1HRT2,U"C/08T+_208T$*,]$C-1HRT
  631. XMB,E)C(2XQDP8Q$PXPDQ)P$QHM,B)3*ATS(5,V$3/@DT<#3K4G6?87:(0V`JP
  632. XM````+BX%`$4.@*`VM0```%,\-O4T$]DQ[)77L-5O%=52;38VT61\]UC+AXR8
  633. XMFL.K"QO;&SM+.TML^YR[[%Q+_,M;L*`VM@```%,\-O4TN[7,O\3%OLNYS[:T
  634. XML[2SL;VQL*PZF,F'C+A7SW1M%C;38O7546U;#LG743V3$*!@MP```%,V/_(T
  635. XMP+^\Q;G'M\FURK2SR[#/K0G1C2?3?3?4;4;4]M1M5=5M7UU6U?75;5XEUMH0
  636. XMK!XEUFUO76;6]=9M9=9M;VUFUFU7U7U7U8U)TZTK'1L\_*N,FYQ[S$P+\9!<
  637. XMN@```%]"/_(TL+VMPJK$J,:FQZ6CR:',H,V<Z,]]!]!]%M%M'VT6TETFTO72
  638. XM;2]=)M+J!=-M/UTVT_73;373;3]M-M-M)])])]*-&="@SZ'/I,S'J<:JQ*S"
  639. XML;P0D%R[````7T(_\C0;RQPJS$JL:IQ\RDSZ'/H-"=&-)])])])M-M/VTVTU
  640. XMTVT_73;3]=-NH--=)OTETFTO72;272;1]M%M%M%]!]!\^,Z<V@S*')HZ7'IL
  641. XM:HQ*K"K;VP"09;X```!?0E/R/K&\K<*JQ*C&IL>EI,F@S*#-G.C/C/?0?1;1
  642. XM;1]M%M)=)M)=)M+B72;2Z5TVT^)=-M-=-M-=-M/VTVTVTGTGTHT8T9T*#0H<
  643. XMZDS,>IQJK$K<&QO``^K435+6/5/4$)!DOP```%]"4_(^&\L<&MQ*K&J<?,I,
  644. XMZAT*#0G1C1C2?2?2;3;3]M-M-=-M-=-M/B73;ITUTFXM)=)M)=)M)=)M'VT6
  645. XMT6T7T'SXSXSIS:#,H,FDI<>FQJC$JL*MO`!`+4/5/6+534.0$L@```!3/!GU
  646. XM'QT!!Z'1ZHS5SC&P.\P```!!*BOU*L2M'$S,C)RL;.P]#!TKU)_6?87BVCXM
  647. XMP0`5[B'</BVEV'_6G4O2P=##SL;*R<C,Q-&L0(#&S0```'AA4/4]KYC2HLFJ
  648. XMPK"]M+F8EIBUE:"5L9.HDZV2KI*JD;*1J)"VD*60NI"BB^B@C`B>C"B<?&>:
  649. XM?(>8?*>6?,>5;.:4;0:2]M)I!M1H765VUF9=A5;89/7:4VVF+B7<46W)+I#>
  650. XMDMQN(5W%)MIC]=I4;895V%9M9G766&U&D/;2:2;0:4;.:5?,>6?*>8?(>:?&
  651. XM><C"B>C`B@B^BBD+J0I9"VD*B1LI&JDJZ2K9.HD[&5H)6UF):8N;2]L,*JR:
  652. XM+2F*\+`VS@```#8D4/4]Q$TVT>>-'D;3XTU2QVDI8[4EL<,B($HB+#&U);-I
  653. XM*6QN--/C;1[+C1[!;3Y4Q+!;SP```#8D4/4]Q$TVT>:-'C;3XDQFDI8[4EL<
  654. XM,B($HB+#&F)J-I*6QN)-/C;1YHT6TT`H33;1YHT>)M/B3(&TP!27)Y'!0D!J
  655. XM0DP1ER>4*TLL?B33XFT>:-%M-,2P;=4````X+5#U/=5MFM;`U&-=)E7156T&
  656. XM2.+.9)S72<UEG-9GS7=<[B?:;:XWV?C9XGV>.-E]GDC8G8XXV)V.2-E]GCC9
  657. XMXGV?C9XWVFVN)\U8?,=VS)9LR5?,^5;-E5SH5L]F705ETE-M3`UJV6U0P,C8
  658. XM````02Q)]D(!0P&_4!E@&5W*1=G9U]K6B)U7Q]1M)])M.-!M.K;4NFT\GVU%
  659. XM)G;48V9M1497U%1T?39'1]-5<WTV9R]]-7<GTF=R?26'&-)8T]%HT_T5G3T&
  660. XMG3T%K3QJT_Q;T[:]/[7-.FS3I=#3EM#3^5T=.&T=.%TH%X72<G=M)R=UTW*&
  661. XM72@H5M*#=5TW1T;3='1=1U9%U&9R;3=G)=1W8EU&G--JO4:ZTVT(TVTGTFU'
  662. XMQ]68C6VM?9V52MQ0&6`9]0&S`4"A%-D```!425/[/\2PW[C8OM/"S[&;',FV
  663. XMG*>\?'?`?$;$;";&;`;(:^7,6\7.6Z706X726W342V746T766R786Q3:2P7:
  664. XM6DW$E=Q83>1UWE9,&+Q&2^.#N45;P[(K=42\.U&W1$NSMQMD-;H[D;522Z2Y
  665. XM&V0DN4MUM4)+E+9K5!6X2W:UFY2W:VBX6W:VBX6X2WC[A,^.>W7/FV7.7Q2W
  666. XM3.0DMUS4);9<Q3]+=+P;1$6W2Z&T54MTNAM$9+A+@;5&6X.X&T5TN3MAM4A;
  667. XMD[0;592Z.Q*V2ENT<K=;!+Z+E+%=A;)=9;1=1;9-1+==);A=!;I<Y;Q<Q;YL
  668. XMAL!L9L)L1L1\!\=[Q\J;:<RQFQS\+3OMBXW[#$!0$=H````S*"K[*1@!UN>W
  669. XMK6&`$(@,X````$H86^!""Q[7E<@-X0```$H86^!$X$.M$..@.N(```!*&UO@
  670. XM0KQ+IKE[B+>+>+>+>+>+>+>+>;:;>+>;:;>+>;>+?YMOFV^;:K;YMN*K:;;D
  671. XMJVFV[9JVP$/C````2AQ=\D35[=KBU*U/K4K5G5G5K4K4K4G5G5G4G5G4G3K5
  672. XMC77:C7K8G8G7G8G7G7G7K6K6K6G7G6K6^M;BK6[=H*@XY````$H;6^!$[9JW
  673. XMFWY*MYM^*K?YMZM_FX^;CYN(N)N(N)N)N(N)N)N(N8N8N8N8N8N8N8N7NFO$
  674. XMR`WP````2AE;[T(.W@0]*H`,\0```$H96^]$ENUPNZ@X\@```$H<6_)"2]:[
  675. XM>ZBZFYFYFYFYFYFYFYBZBYFYFYBYFY^;GYN?FXJX^;BKCYN/JXFXY*N)N.V:
  676. XMR$/S````2AM=X$3MVM7BK5^M6M6=6M6M6=:=:=:=>=:=>=>->M=]E==]2M.-
  677. XM2=.=2=.=2=2=2=2M.M2=2M/ZT^*M/MVM0*`Z]````$H<6_)$M^V:MYM^2K>;
  678. XM?ZM_FWJW^;>K?YM_FW^;>;B+B;>;B+B+B;>;>;>;>;>;>;>+E[IKM+W8"_4`
  679. XM``!*"EW@1``Z0!@)]@```%Q;`@`9U'!E^P```'AA-?4OG$U&TUTVTFTUTVTF
  680. XMTFTUTVTFTFTKV2P8_"CL.,Q8M]"`SX'.@<V#RX3*A<B'RH7,A\Z%SX30@]&!
  681. XMTH'2@--]/%CL./PI#!DKV5;4;4;474;4;4;474;4;474;42QV`O\````,R@J
  682. XM^RD`:2!P9?T```!X837U+[%-1M1=1M1M1=1M1M1M1=1M1M1I6]DL&0PH_#CL
  683. XM73?3@-*!TH'1@]"$SX7.A\R%RH?(A<J$RX/-@<Z!SX#0>+Q8S#CL*/P9*]TF
  684. XMTFTFTUTVTFTFTUTVTFTUTVU$G)`=_@```%](2_5#N3VDVNMEN-P0GAW+GK-;
  685. X(C<$)X=P0]?8F
  686. X`
  687. Xend
  688. END_OF_FILE
  689.   if test 13015 -ne `wc -c <'fonts.lj/S.22.pk.UU'`; then
  690.     echo shar: \"'fonts.lj/S.22.pk.UU'\" unpacked with wrong size!
  691.   fi
  692.   # end of 'fonts.lj/S.22.pk.UU'
  693. fi
  694. if test -f 'utils.c' -a "${1}" != "-c" ; then 
  695.   echo shar: Will not clobber existing file \"'utils.c'\"
  696. else
  697.   echo shar: Extracting \"'utils.c'\" \(12801 characters\)
  698.   sed "s/^X//" >'utils.c' <<'END_OF_FILE'
  699. X/*
  700. X    Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  701. X        All Rights Reserved
  702. X
  703. X    See the LICENSE file for a full description of restrictions under which
  704. X    this software is provided.
  705. X
  706. X    Function:        Utility functions (font loads, prologs etc.)
  707. X */
  708. X
  709. X#include "defs.h"
  710. X
  711. X#ifndef    lint
  712. Xstatic char SCCSid[] =
  713. X    "@(#)utils.c: 2.14 Copyright 91/04/05 01:21:20 Chris Lewis";
  714. X#endif
  715. X
  716. X#ifndef    HEADERSIZE
  717. X#    ifdef COFF
  718. X#        include <aouthdr.h>
  719. X#        include <filehdr.h>
  720. X#        include <scnhdr.h>
  721. X#        include <ldfcn.h>
  722. X#        include <reloc.h>
  723. X#        define H1 (sizeof (struct filehdr) + sizeof (struct aouthdr))
  724. X#        define H2 (sizeof (struct scnhdr) + sizeof (struct reloc))
  725. X#        define HEADERSIZE (H1 + H2)
  726. X#    else
  727. X#        include <a.out.h>
  728. X#        define HEADERSIZE (sizeof (struct exec))
  729. X#    endif
  730. X#endif
  731. X
  732. Xextern struct cattab tabN[], tabS[];
  733. X
  734. Xint lastFont, lastPoints;
  735. Xint lastYPos, lastXPos;
  736. X
  737. Xint symidx = 3;        /* Default on otroff, otroff doesn't necessarily
  738. X               emit loads either */
  739. X
  740. Xint extcount = 0;
  741. Xstruct troff2befont *extchars;
  742. Xstruct cattab *extidx;
  743. X
  744. Xextern char *malloc();
  745. X
  746. Xchar *skipblanks(p)
  747. Xregister char *p; {
  748. X    while (*p && isspace(*p)) p++;
  749. X    return(p);
  750. X}
  751. X
  752. Xchar *gettok(p, bp)
  753. Xregister char *p, *bp; {
  754. X    p = skipblanks(p);
  755. X    while(*p && !isspace(*p)) *bp++ = *p++;
  756. X    *bp = '\0';
  757. X    return(p);
  758. X}
  759. X
  760. Xinterp(buf, xlator, suf)
  761. Xchar *buf, *suf; FUNC xlator; {
  762. X    register char *p;
  763. X    char token[512];
  764. X    p = gettok(buf, token);
  765. X    if (0 == strcmp(token, "include") || 0 == strcmp(token, "binclude")) {
  766. X    int binary;
  767. X    FILE *inc;
  768. X    binary = (token[0] == 'b') ? 1: 0;
  769. X    p = gettok(p, token);
  770. X    DBP((D_SPEC, "Trying to include %s\n", token));
  771. X    if (!(inc = fopen(token, "r"))) {
  772. X        strcat(token, ".");
  773. X        strcat(token, suf);
  774. X        DBP((D_SPEC, "Trying to include %s\n", token));
  775. X        if (!(inc = fopen(token, "r"))) {
  776. X        char nbuf[512];
  777. X        if (token[0] != '/') {
  778. X            sprintf(nbuf, "%s/%s", LIBDIR, token);
  779. X            DBP((D_SPEC, "Trying to include %s\n", nbuf));
  780. X            inc = fopen(nbuf, "r");
  781. X        }
  782. X        }
  783. X    }
  784. X    if (!inc) {
  785. X        fprintf(stderr, "%s: cannot open file %s\n", progname, token);
  786. X        exit(1);
  787. X    } else {
  788. X        DBP((D_SPEC, "Successfull include\n"));
  789. X        if (binary || !xlator)
  790. X        while ((binary = fread(token, 1, sizeof(token), inc)) > 0)
  791. X            fwrite(token, 1, binary, stdout);
  792. X        else
  793. X        (*xlator)(inc);
  794. X        fclose(inc);
  795. X    }
  796. X    }
  797. X
  798. X    else {
  799. X    fprintf(stderr, "%s: unknown directive: %s\n", progname, token);
  800. X    exit(1);
  801. X    }
  802. X}
  803. X
  804. Xchar nodename[25];
  805. Xgetnodename() {
  806. X    FILE *popen();
  807. X    FILE *uuname;
  808. X    if ((uuname = popen(NODECMD, "r")) == NULL)
  809. X    strcpy(nodename, "<noname>");
  810. X    else {
  811. X    fscanf(uuname, "%s", nodename);
  812. X    if (pclose(uuname))
  813. X        strcpy(nodename, "<noname>");
  814. X    }
  815. X}
  816. X
  817. Xstruct fonttable fonttable[MAXFONTS+1];
  818. Xstruct fonttable *xlatetable[INTFONTS];
  819. X
  820. X#define    READFONT    0
  821. X#define    READNORM    1
  822. X#define    READSYMB    2
  823. X#define    READEXT        3
  824. X
  825. Xloadfont(normfont, symfont)
  826. Xstruct troff2befont *normfont, *symfont; {
  827. X
  828. X    char buffer[BUFSIZ];
  829. X    char *buf[6];
  830. X    int tableindex;
  831. X    int state, i, count;
  832. X    register char *first;
  833. X    extern int atoi();
  834. X    struct cattab *tab;
  835. X    struct troff2befont *otab;
  836. X    int done;
  837. X
  838. X    FILE *fontfile;
  839. X
  840. X    for (i = 0; i < 6; i++)
  841. X    buf[i] = mustmalloc(64, "loadfont");
  842. X
  843. X    for (tableindex = 0; tableindex < INTFONTS; tableindex++) {
  844. X    xlatetable[tableindex] = &fonttable[tableindex];
  845. X    }
  846. X
  847. X    fontfile = libopen(printer, "fonts");
  848. X
  849. X    tableindex = 0;
  850. X
  851. X    state = READFONT;
  852. X
  853. X    while(fgets(buffer, sizeof(buffer), fontfile)) {
  854. X
  855. X    first = buffer;
  856. X
  857. X    for(;*first && isspace(*first); first++);
  858. X
  859. X    if (!*first || *first == '#')
  860. X        continue;
  861. X
  862. X    switch(count = sscanf(first, "%s%s%s%s%s%s",
  863. X        buf[0], buf[1], buf[2], buf[3], buf[4], buf[5])) {
  864. X        case 1: buf[1][0] = '\0';
  865. X        case 2: buf[2][0] = '\0';
  866. X        case 3: buf[3][0] = '\0';
  867. X        case 4: buf[4][0] = '\0';
  868. X        case 5: buf[5][0] = '\0';
  869. X        case 6:
  870. X        if        (strcmp(buf[0], "normal") == 0) {
  871. X            state = READNORM;
  872. X            break;
  873. X        } else if (strcmp(buf[0], "symbol") == 0) {
  874. X            state = READSYMB;
  875. X            break;
  876. X        } else if (strcmp(buf[0], "extensions") == 0) {
  877. X            state = READEXT;
  878. X            break;
  879. X        }
  880. X        switch(state) {
  881. X            case READFONT:
  882. X            if (tableindex == MAXFONTS) {
  883. X                fprintf(stderr, "%s: Too many fonts for %s!\n",
  884. X                progname, printer);
  885. X                exit(1);
  886. X            }
  887. X            for(i = 0; i < 4; i++) {
  888. X                first = mustmalloc(strlen(buf[i])+1,
  889. X                "fonttable");
  890. X                strcpy(first, buf[i]);
  891. X                fonttable[tableindex].tab[i] = first;
  892. X            }
  893. X#ifdef    OPT
  894. X            fonttable[tableindex].widthtable = (char *) NULL;
  895. X#endif
  896. X            tableindex++;
  897. X            break;
  898. X            case READNORM: case READSYMB: case READEXT:
  899. X            done = 0;
  900. X            if (count <= 1) {
  901. X                fprintf(stderr, "%s: bad %s.fonts line: %s\n",
  902. X                progname, printer, buffer);
  903. X                exit(1);
  904. X            }
  905. X
  906. X            if (state == READEXT) {
  907. X                if (!(extcount % EXTCHUNK)) {
  908. X                if (!extchars) {
  909. X                    extchars = (struct troff2befont *)
  910. X                    mustmalloc(EXTCHUNK *
  911. X                    sizeof(struct troff2befont), "extchars");
  912. X                    extidx = (struct cattab *)
  913. X                    mustmalloc((1 + EXTCHUNK) *
  914. X                    sizeof(struct cattab), "extidx");
  915. X                } else {
  916. X                    extchars = (struct troff2befont *)
  917. X                    realloc((char *) extchars,
  918. X                        (extcount + EXTCHUNK + 1) *
  919. X                        sizeof(struct troff2befont));
  920. X                    extidx = (struct cattab *)
  921. X                    realloc((char *) extidx,
  922. X                        (extcount + EXTCHUNK + 1) *
  923. X                        sizeof(struct cattab));
  924. X                    clrarray(&extchars[extcount],
  925. X                    EXTCHUNK * sizeof(struct troff2befont));
  926. X                    clrarray(&extidx[extcount],
  927. X                    EXTCHUNK * sizeof(struct cattab));
  928. X                }
  929. X                }
  930. X
  931. X                extidx[extcount].ch_name = mustmalloc(strlen(buf[0])
  932. X                + 1, "extend");
  933. X                strcpy(extidx[extcount].ch_name, buf[0]);
  934. X
  935. X                extidx[extcount].ch_catidx = extcount;
  936. X                addchar(&extchars[extcount], buf, count, buffer);
  937. X                extidx[extcount].ch_set = extchars[extcount].t2b_font;
  938. X                extidx[extcount].ch_wididx = NTC;
  939. X                extidx[extcount].ch_desc = "Ext";
  940. X
  941. X                extcount++;
  942. X                extidx[extcount].ch_name = NOC;
  943. X                done = 1;
  944. X            } else {
  945. X                if (state == READNORM) {
  946. X                tab = tabN;
  947. X                otab = normfont;
  948. X                } else {
  949. X                tab = tabS;
  950. X                otab = symfont;
  951. X                }
  952. X
  953. X                for (i = 0; tab[i].ch_name; i++) {
  954. X                if (strcmp(tab[i].ch_name, buf[0]) == 0) {
  955. X                    addchar(&otab[i], buf, count, buffer);
  956. X                    done = 1;
  957. X                    break;
  958. X                }
  959. X                }
  960. X            }
  961. X            if (!done) {
  962. X                fprintf(stderr, "%s: couldn't apply %s.fonts: %s\n",
  963. X                progname, printer, buffer);
  964. X                exit(1);
  965. X            }
  966. X        }
  967. X    }
  968. X    }
  969. X    fclose(fontfile);
  970. X#ifdef    OPT
  971. X    loadwidth(xlatetable[0]);
  972. X    loadwidth(xlatetable[1]);
  973. X    loadwidth(xlatetable[2]);
  974. X    loadwidth(xlatetable[3]);
  975. X#endif
  976. X    for (i = 0; i < 6; i++)
  977. X    free(buf[i]);
  978. X}
  979. X
  980. Xaddchar(p, fontentry, count, buffer)
  981. Xregister struct troff2befont *p;
  982. Xchar *fontentry[];
  983. Xchar *buffer;
  984. Xint count; {
  985. X    register char *first;
  986. X    switch(fontentry[1][0]) {
  987. X    case 'N':
  988. X        p->t2b_font = N; break;
  989. X    case 'S':
  990. X        p->t2b_font = S; break;
  991. X    case 'D':
  992. X        p->t2b_font = D; break;
  993. X    case '0':
  994. X    case '1':
  995. X    case '2':
  996. X    case '3':
  997. X    case '4':
  998. X    case '5':
  999. X    case '6':
  1000. X    case '7':
  1001. X    case '8':
  1002. X    case '9':
  1003. X        p->t2b_font = atoi(fontentry[1]);
  1004. X        break;
  1005. X    default:
  1006. X        fprintf(stderr, "%s: bad font in %s\n",
  1007. X        progname, buffer);
  1008. X        exit(1);
  1009. X    }
  1010. X    switch(count) {
  1011. X    case 6:
  1012. X        p->t2b_scale = atoi(fontentry[5]);
  1013. X    case 5:
  1014. X        p->t2b_yc = atoi(fontentry[4]);
  1015. X    case 4:
  1016. X        p->t2b_xc = atoi(fontentry[3]);
  1017. X    case 3:
  1018. X        octdecode(fontentry[2]);
  1019. X        first = mustmalloc(strlen(fontentry[2]) + 1,
  1020. X        "fonttable");
  1021. X        strcpy(first, fontentry[2]);
  1022. X        p->t2b_charseq = first;
  1023. X    }
  1024. X}
  1025. X
  1026. X/*    Translate any octal escapes *inplace* */
  1027. Xoctdecode(str)
  1028. Xregister char *str; {
  1029. X    register char *from, *to;
  1030. X    int tmp, i;
  1031. X    from = to = str;
  1032. X    while(*from) {
  1033. X    if (*from != '\\')
  1034. X        *to++ = *from++;
  1035. X    else {
  1036. X        tmp = 0;
  1037. X        from++;
  1038. X        i = 3;
  1039. X        while(i-- > 0 && *from && *from >= '0' && *from <= '7')
  1040. X        tmp = (tmp << 3) + *from++ - '0';
  1041. X        *to++ = tmp&0xff;
  1042. X    }
  1043. X    }
  1044. X    *to++ = '\0';
  1045. X}
  1046. X
  1047. X
  1048. Xdumpsequence(sequence)
  1049. Xregister char *sequence; {
  1050. X    printf("\t");
  1051. X    for(;*sequence;sequence++)
  1052. X    if (isascii(*sequence) && isprint(*sequence))
  1053. X        printf("%c", *sequence);
  1054. X    else
  1055. X        printf("\\%03o", (*sequence)&0xff);
  1056. X}
  1057. X
  1058. Xdumpline(name, tp)
  1059. Xregister char *name;
  1060. Xregister struct troff2befont *tp; {
  1061. X    if (name != NOC) {
  1062. X    printf("%s\t", name);
  1063. X    switch(tp->t2b_font) {
  1064. X        case N: printf("N"); break;
  1065. X        case S: printf("S"); break;
  1066. X        case D: printf("D"); break;
  1067. X        default: printf("%d", tp->t2b_font); break;
  1068. X    }
  1069. X    dumpsequence(tp->t2b_charseq);
  1070. X    printf("\t%d\t%d\t%d", tp->t2b_xc, tp->t2b_yc, tp->t2b_scale);
  1071. X    printf("\n");
  1072. X    }
  1073. X}
  1074. X
  1075. Xdumplist(namelist, tp)
  1076. Xregister struct cattab *namelist;
  1077. Xregister struct troff2befont *tp; {
  1078. X    register int i;
  1079. X    for (i = 0; namelist[i].ch_name && namelist[i].ch_catidx != NTC;
  1080. X    i++, tp++) {
  1081. X    if (strlen(namelist[i].ch_name) == 0)
  1082. X        continue;
  1083. X    if (strcmp(namelist[i].ch_name, "hy") == 0)
  1084. X        dumpline("-", tp);
  1085. X    dumpline(namelist[i].ch_name, tp);
  1086. X    }
  1087. X}
  1088. X
  1089. Xdumptables(bep)
  1090. Xstruct backend *bep; {
  1091. X    if (!bep) {
  1092. X    fprintf(stderr, "%s: no backend selected for table dump\n", progname);
  1093. X    exit(1);
  1094. X    }
  1095. X    printf("normal\n");
  1096. X    dumplist(tabN, bep->bestdfont);
  1097. X    printf("symbol\n");
  1098. X    dumplist(tabS, bep->besymfont);
  1099. X    if (extchars) {
  1100. X    printf("extensions\n");
  1101. X    dumplist(extidx, extchars);
  1102. X    }
  1103. X}
  1104. X
  1105. XFontSel(from, to)
  1106. Xchar from, *to; {
  1107. X#ifdef    DEBUG
  1108. X    register int i;
  1109. X#endif
  1110. X    register struct fonttable *p;
  1111. X    int intfont;
  1112. X    DBP((D_SPEC, "FontSel: %c -> %s\n", from, to));
  1113. X    if (from < (ditroff? '0' : '1') || from > '9') {
  1114. X    fprintf(stderr, "Bad arguments to FontSel: %c %s\n", from, to);
  1115. X    return;
  1116. X    }
  1117. X    intfont = from - '1';
  1118. X    if (intfont < 0)
  1119. X    intfont = INTFONTS - 1;
  1120. X    if (strcmp(to, "S") == 0) {
  1121. X    symidx = intfont;
  1122. X    DBP((D_CAT, "Special font is: %d\n", symidx));
  1123. X    }
  1124. X
  1125. X    for (p = fonttable; p->troffName; p++)
  1126. X    if (strcmp(p->troffName, to) == 0) {
  1127. X        xlatetable[intfont] = p;
  1128. X        break;
  1129. X    }
  1130. X    if (!p->troffName) {
  1131. X    fprintf(stderr, "Could not translate font %c (%s)\n", from, to);
  1132. X    }
  1133. X#ifdef    OPT
  1134. X    if (p->troffName && !p->widthtable)
  1135. X    loadwidth(p);
  1136. X#endif
  1137. X
  1138. X#ifdef    DEBUG
  1139. X    for (i = 0; i < INTFONTS; i++)
  1140. X    if (xlatetable[i])
  1141. X        DBP((D_SPEC, "Font %d->%s\n", i+1, xlatetable[i]->fontName));
  1142. X#endif
  1143. X}
  1144. X
  1145. XFILE *libopen(pref, suf)
  1146. Xregister char *pref, *suf; {
  1147. X
  1148. X    register char *buffer = mustmalloc(strlen(LIBDIR) + 50, "libopen");
  1149. X    register FILE *library;
  1150. X
  1151. X    sprintf(buffer, "%s.%s", pref, suf);
  1152. X    if ((library = fopen(buffer, "r")) == NULL) {
  1153. X    sprintf(buffer, "lib/%s.%s", pref, suf);
  1154. X    if ((library = fopen(buffer, "r")) == NULL) {
  1155. X        sprintf(buffer, "%s/%s.%s", LIBDIR, pref, suf);
  1156. X        if ((library = fopen(buffer, "r")) == NULL) {
  1157. X        fprintf(stderr, "Cannot find %s.%s in . or lib or %s\n", pref, suf,
  1158. X            LIBDIR);
  1159. X        exit(1);
  1160. X        }
  1161. X    }
  1162. X    }
  1163. X    free(buffer);
  1164. X    return(library);
  1165. X}
  1166. X
  1167. XresetState() {
  1168. X    lastFont = -1;
  1169. X    lastPoints = -1;
  1170. X    lastYPos = -1;
  1171. X    lastXPos = -1;
  1172. X}
  1173. X
  1174. Xdoprologs() {
  1175. X    if (!prologs)
  1176. X    return;
  1177. X    while(*prologs)
  1178. X    dospecial(*prologs++);
  1179. X}
  1180. X
  1181. X#ifdef    OPT
  1182. Xloadwidth(p)
  1183. Xstruct fonttable *p; {
  1184. X    FILE *f;
  1185. X    int c;
  1186. X    if ((int) p->widthtable == 1)
  1187. X    return;
  1188. X    p->widthtable = mustmalloc(224, "widthtable");
  1189. X    strcpy(widthptr, "ft");
  1190. X    strcat(widthptr, p->troffName);
  1191. X    DBP((D_SPEC, "Attempting to read font file %s\n", widthtables));
  1192. X    if (f = fopen(widthtables, "r")) {
  1193. X    for (c = 0; c < HEADERSIZE; c++) getc(f);
  1194. X#ifdef    ASCIIWIDTHS
  1195. X    if (widread(p->widthtable, f)) {
  1196. X#else
  1197. X    if (224 != fread(p->widthtable, 1, 224, f)) {
  1198. X#endif
  1199. X        fprintf(stderr, "%s: badly formed width table %s\n",
  1200. X        progname, widthtables);
  1201. X        free(p->widthtable);
  1202. X        p->widthtable = (char *) 1;
  1203. X        DBP((D_SPEC, "Load of %s failed\n", widthtables));
  1204. X    } else {
  1205. X        for (c = 0; c < 224; c++)
  1206. X        p->widthtable[c] &= 0x3f;
  1207. X        DBP((D_SPEC, "Load of %s succeeded\n", widthtables));
  1208. X    }
  1209. X    } else {
  1210. X    DBP((D_SPEC, "Failed to open widthtable %s\n", widthtables));
  1211. X    free(p->widthtable);
  1212. X    p->widthtable = (char *) 1;
  1213. X    }
  1214. X}
  1215. X
  1216. X#ifdef    ASCIIWIDTHS
  1217. Xwidread(widths, f)
  1218. Xchar *widths;
  1219. XFILE *f; {
  1220. X    int v, i;
  1221. X    for (i = 0; i < 224; i++)
  1222. X    if (fscanf(f, "%d", &v) != 1)
  1223. X        return(1);
  1224. X    else
  1225. X        widths[i] = v;
  1226. X    return(0);
  1227. X}
  1228. X#endif
  1229. X
  1230. X#endif
  1231. X
  1232. X#ifdef    NULLCHECK
  1233. Xmab() {
  1234. X    fprintf(stderr, "KABOOM\n");
  1235. X    abort();
  1236. X}
  1237. X#endif
  1238. X
  1239. Xdrawparse(ct, values, str)
  1240. Xint *ct;
  1241. Xshort *values;
  1242. Xchar *str; {
  1243. X    int opcode, neg, temp;
  1244. X
  1245. X    *ct = 0;
  1246. X    while(*str && isspace(*str)) str++;
  1247. X    opcode = *str;
  1248. X    neg = 1;
  1249. X    for (;*str;str++) {
  1250. X    if (isspace(*str))
  1251. X        continue;
  1252. X    else if (*str == '\\')
  1253. X        str += 3;
  1254. X    else if (*str == '-')
  1255. X        neg = -1;
  1256. X    else if (!isdigit(*str))
  1257. X        continue;
  1258. X    else {
  1259. X        temp = *str - '0';
  1260. X        while(isdigit(*(str+1)))
  1261. X        temp = temp * 10 + (*++str - '0');
  1262. X        values[(*ct)++] = neg * temp;
  1263. X        neg = 1;
  1264. X    }
  1265. X    }
  1266. X    return(opcode);
  1267. X}
  1268. END_OF_FILE
  1269.   if test 12801 -ne `wc -c <'utils.c'`; then
  1270.     echo shar: \"'utils.c'\" unpacked with wrong size!
  1271.   fi
  1272.   # end of 'utils.c'
  1273. fi
  1274. if test -f 'utils/psxlate.c' -a "${1}" != "-c" ; then 
  1275.   echo shar: Will not clobber existing file \"'utils/psxlate.c'\"
  1276. else
  1277.   echo shar: Extracting \"'utils/psxlate.c'\" \(12922 characters\)
  1278.   sed "s/^X//" >'utils/psxlate.c' <<'END_OF_FILE'
  1279. X/*
  1280. X    Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  1281. X        All Rights Reserved
  1282. X
  1283. X    See the LICENSE file for a full description of restrictions under which
  1284. X    this software is provided.
  1285. X
  1286. X    Function:        Generic Postscript filter (page reversal etc.)
  1287. X */
  1288. X
  1289. X/* If you wish to add new shuffle algorithms, you will have to:
  1290. X    - update the getopt for the new option letter (see /OPTION/)
  1291. X      by adding the new option letter to the getopt string.
  1292. X    - update the argument parsing to recognize the new option
  1293. X      (/OPTIONPARSE/) by adding a case clause.
  1294. X    - update the "transform" routine to call your shuffle function,
  1295. X      selected upon the option letter.
  1296. X    - add a new transform routine (see the "o_" functions for
  1297. X      samples)
  1298. X   If you write one, please let me know and I'll reintegrate it
  1299. X   into the original.  Please note: I will assume that any contributions
  1300. X   are public domain.
  1301. X */
  1302. X#ifndef    lint
  1303. Xstatic char SCCSid[] =
  1304. X    "@(#)psxlate.c: 2.11 Copyright 91/03/26 00:13:16 Chris Lewis";
  1305. X#endif
  1306. X
  1307. X#ifdef    ALONE
  1308. X#include <stdio.h>
  1309. X#include <ctype.h>
  1310. X#else
  1311. X#include "defs.h"
  1312. X#endif
  1313. X
  1314. Xint    xlate = 0;
  1315. Xextern int    italic = 0;
  1316. Xint    needd = 0;
  1317. X#define    BUFFERSIZE    512
  1318. X
  1319. Xint    half = 0;    /*    Controls emitter, 0: whole file, 1: first half,
  1320. X                2: second half */
  1321. X
  1322. X/* define if you want to page flip %! documents (eg: some TeX out stuff)
  1323. X   not recommended....
  1324. X */
  1325. X#undef    TRYPERBANG
  1326. X
  1327. Xstruct range {
  1328. X    int start;
  1329. X    int end;
  1330. X} ranges[100];
  1331. X
  1332. Xint ri;
  1333. X
  1334. Xstruct pagedesc {
  1335. X    unsigned long start;
  1336. X    unsigned long end;
  1337. X} pageidx[MAXPAGE], prolog, epilog;
  1338. X
  1339. Xstruct pagedesc blankpage = {-1, -1};
  1340. X
  1341. Xchar shuffle[100];
  1342. X
  1343. Xchar tmp[] = {"/tmp/psxXXXXXX"};
  1344. X
  1345. Xint pagecnt = 0;
  1346. Xchar *progname;
  1347. Xint debug, verbose;
  1348. Xchar *mygets();
  1349. X
  1350. X#ifndef    LIBDIR
  1351. X#define    LIBDIR    "/usr/lib/troff2"
  1352. X#endif
  1353. X
  1354. Xchar    cmdbuffer[BUFFERSIZE];    /* for psnup stuff */
  1355. Xint    psnupok = 0, psnupwanted = 0;
  1356. Xint    reversed = 0, pages = 2, startspot = 0;
  1357. X
  1358. Xchar *magicstr;
  1359. X
  1360. XFILE *tempfile;
  1361. X
  1362. Xmain(argc, argv)
  1363. Xint argc; char **argv; {
  1364. X    extern int optind;
  1365. X    extern char *optarg;
  1366. X    char *buffer;
  1367. X    int c;
  1368. X    char *si = shuffle;
  1369. X    long offset, oldoffset;
  1370. X
  1371. X    progname = argv[0];
  1372. X
  1373. X
  1374. X    while ((c = getopt(argc, argv, "i2drbcvBEn:p:s:")) != EOF)    /* OPTION */
  1375. X    switch(c) {
  1376. X        /* OPTIONPARSE */
  1377. X        case '2':
  1378. X        case 'r':
  1379. X        case 'b':
  1380. X        case 'c':
  1381. X        *si++ = c;
  1382. X        if (c == 'r')
  1383. X            reversed = 1;
  1384. X        break;
  1385. X        case 'i':
  1386. X        italic = 1;
  1387. X        break;
  1388. X        case 'p':
  1389. X        psnupwanted = 1;
  1390. X        pages = atoi(optarg);
  1391. X        if (pages != 2 && pages != 4 && pages != 8 && pages != 16) {
  1392. X            fprintf(stderr, "%s: -p must be 2, 4, 8 or 16\n",
  1393. X            progname);
  1394. X            exit(1);
  1395. X        }
  1396. X        break;
  1397. X        case 's':
  1398. X        psnupwanted = 1;
  1399. X        startspot = atoi(optarg);
  1400. X        break;
  1401. X        case 'E': half++;
  1402. X        case 'B': half++;
  1403. X        break;
  1404. X        case 'd': debug = 1; break;
  1405. X        case 'v': verbose = 1; break;
  1406. X        case 'n':
  1407. X        readranges(optarg);
  1408. X        break;
  1409. X        default:
  1410. X        usage();
  1411. X        exit(1);
  1412. X    }
  1413. X
  1414. X    if (psnupwanted) {
  1415. X    psnupok = 1;
  1416. X    if (startspot < 0 || startspot >= pages) {
  1417. X        fprintf(stderr, "%s: -s (%d) must be 0..%d (-p%d - 1)\n",
  1418. X        progname, startspot, pages - 1, pages);
  1419. X        psnupok = 0;
  1420. X    }
  1421. X    sprintf(cmdbuffer, "%s/nup.pro", LIBDIR);
  1422. X    if (access(cmdbuffer, 4) != 0) {
  1423. X        fprintf(stderr, "%s: can't do n-up (no nup.pro at %s)\n",
  1424. X        progname, cmdbuffer);
  1425. X        psnupok = 0;
  1426. X    }
  1427. X    sprintf(cmdbuffer, "%s/nup.epi", LIBDIR);
  1428. X    if (access(cmdbuffer, 4) != 0) {
  1429. X        fprintf(stderr, "%s: can't do n-up (no nup.epi at %s)\n",
  1430. X        progname, cmdbuffer);
  1431. X        psnupok = 0;
  1432. X    }
  1433. X    if (!psnupok)
  1434. X        exit(1);
  1435. X    }
  1436. X
  1437. X    if (debug) {
  1438. X    fprintf(stderr, "startspot: %d\n", startspot);
  1439. X    fprintf(stderr, "pages: %d\n", pages);
  1440. X    fprintf(stderr, "reversed: %d\n", reversed);
  1441. X    fprintf(stderr, "psnupwanted: %d\n", psnupwanted);
  1442. X    fprintf(stderr, "xlate: %s\n", shuffle);
  1443. X    for (c = 0; c < ri; c++)
  1444. X        fprintf(stderr, "RANGE %d: %d-%d\n", c, ranges[c].start, ranges[c].end);
  1445. X    }
  1446. X
  1447. X    mktemp(tmp);
  1448. X    tempfile =  fopen(tmp, "w");
  1449. X    if (!tempfile) {
  1450. X    fprintf(stderr, "%s: couldn't open temp file %s\n",
  1451. X        progname, tmp);
  1452. X    exit(1);
  1453. X    }
  1454. X    if (buffer = mygets(stdin, tempfile, &offset)) {
  1455. X    if (strncmp(buffer, "%!PS-Adobe-", 11) == 0) {
  1456. X        if (verbose || debug)
  1457. X        fprintf(stderr, "DEBUG: conformant Postscript file %s\n", buffer);
  1458. X
  1459. X        scan(stdin, tempfile, buffer);
  1460. X        stripbyrange();
  1461. X        transform();
  1462. X        emit(tmp);
  1463. X    } else if (strncmp(buffer, "%!", 2) == 0) {
  1464. X        if (verbose || debug)
  1465. X        fprintf(stderr, "DEBUG: nonconformant Postscript file %s\n", buffer);
  1466. X        fputs(buffer, stdout);
  1467. X        while ((c = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
  1468. X        fwrite(buffer, 1, c, stdout);
  1469. X    } else {
  1470. X        if (verbose || debug)
  1471. X        fprintf(stderr, "DEBUG: non-Postscript file %s\n", buffer);
  1472. X        asc2ps(buffer);
  1473. X        stripbyrange();
  1474. X        transform();
  1475. X        emit(tmp);
  1476. X    }
  1477. X    }
  1478. X    cleanup();
  1479. X    exit(0);
  1480. X}
  1481. X
  1482. X/*    States: */
  1483. X#define    PROLOG    0
  1484. X#define    PAGES    1
  1485. X#define    EPILOG    2
  1486. X
  1487. X/*    What we've just seen */
  1488. X#define    S_NONE    0
  1489. X#define    S_EOF    1
  1490. X#define    S_PAGE    2
  1491. X#define    S_EPI    3
  1492. X
  1493. Xscan(in, out, buffer)
  1494. XFILE *in;
  1495. XFILE *out;
  1496. Xchar *buffer; {
  1497. X    extern char *malloc();
  1498. X    long offset;
  1499. X    int state = PROLOG;
  1500. X    int seen;
  1501. X
  1502. X    magicstr = malloc(strlen(buffer) + 1);
  1503. X    strcpy(magicstr, buffer);
  1504. X
  1505. X    while(1) {
  1506. X    buffer = mygets(in, out, &offset);
  1507. X
  1508. X    if (!prolog.start)
  1509. X        prolog.start = offset;
  1510. X
  1511. X    if (!buffer)
  1512. X        seen = S_EOF;
  1513. X    else if (buffer[0] == '%') {
  1514. X        if (strncmp(buffer, "%%Page:", 7) == 0)
  1515. X        seen = S_PAGE;
  1516. X        else if (strncmp(buffer, "%%Trailer", 9) == 0)
  1517. X        seen = S_EPI;
  1518. X        else
  1519. X        seen = S_NONE;
  1520. X    } else
  1521. X        seen = S_NONE;
  1522. X    switch(seen) {
  1523. X        case S_NONE:
  1524. X        continue;
  1525. X        case S_EOF:
  1526. X        switch(state) {
  1527. X            case PROLOG:
  1528. X            prolog.end = offset - 1;
  1529. X            break;
  1530. X            case PAGES:
  1531. X            pageidx[pagecnt].end = offset - 1;
  1532. X            pagecnt++;
  1533. X            break;
  1534. X            case EPILOG:
  1535. X            epilog.end = offset - 1;
  1536. X            break;
  1537. X        }
  1538. X        fclose(out);
  1539. X        if (psnupwanted)
  1540. X            append(pages);
  1541. X        return;
  1542. X        case S_PAGE:
  1543. X        switch(state) {
  1544. X            case PROLOG:
  1545. X            prolog.end = offset - 1;
  1546. X            state = PAGES;
  1547. X            pagecnt = 0;
  1548. X            if (psnupwanted)
  1549. X                while(startspot) {
  1550. X                pageidx[pagecnt++].start = -1;
  1551. X                startspot--;
  1552. X            }
  1553. X            break;
  1554. X            case PAGES:
  1555. X            pageidx[pagecnt].end = offset - 1;
  1556. X            pagecnt++;
  1557. X            break;
  1558. X        }
  1559. X        pageidx[pagecnt].start = offset;
  1560. X        break;
  1561. X        case S_EPI:
  1562. X        switch(state) {
  1563. X            case PROLOG:
  1564. X            prolog.end = offset - 1;
  1565. X            break;
  1566. X            case PAGES:
  1567. X            pageidx[pagecnt].end = offset - 1;
  1568. X            pagecnt++;
  1569. X            break;
  1570. X        }
  1571. X        epilog.start = offset;
  1572. X        state = EPILOG;
  1573. X        break;
  1574. X    }
  1575. X    }
  1576. X}
  1577. X
  1578. Xcleanup() {
  1579. X    if (!debug)
  1580. X    unlink(tmp);
  1581. X}
  1582. X
  1583. Xemit(fname)
  1584. Xchar *fname; {
  1585. X    register int i, start, end;
  1586. X    FILE *file;
  1587. X    if ((file = fopen(fname, "r")) == NULL) {
  1588. X    fprintf(stderr, "Panic %s\n", fname);
  1589. X    exit(1);
  1590. X    }
  1591. X
  1592. X    if (magicstr)
  1593. X    fputs(magicstr, stdout);
  1594. X
  1595. X    if (psnupwanted) {
  1596. X    sprintf(cmdbuffer, "%s/nup.pro", LIBDIR);
  1597. X    emitnup(cmdbuffer, 1);
  1598. X    }
  1599. X
  1600. X    emitsect(file, &prolog);
  1601. X
  1602. X    start = 0;
  1603. X    end = pagecnt - 1;
  1604. X
  1605. X    if (half == 1)
  1606. X    end = end / 2;
  1607. X    else if (half == 2)
  1608. X    start = end / 2 + 1;
  1609. X
  1610. X    for (i = start; i <= end; i++)
  1611. X    emitsect(file, &pageidx[i]);
  1612. X
  1613. X    emitsect(file, &epilog);
  1614. X
  1615. X    if (psnupwanted) {
  1616. X    sprintf(cmdbuffer, "%s/nup.epi", LIBDIR);
  1617. X    emitnup(cmdbuffer, 0);
  1618. X    }
  1619. X
  1620. X    if (needd)
  1621. X    putchar('\004');
  1622. X}
  1623. X
  1624. Xemitsect(file, sect)
  1625. XFILE *file;
  1626. Xstruct pagedesc *sect; {
  1627. X    long start, end, cnt;
  1628. X
  1629. X    if (sect->start == 0 && sect->end == 0)
  1630. X    return;
  1631. X
  1632. X    if (sect->start == -1) {
  1633. X    printf("%%%%Page: ? x\n");
  1634. X    printf("showpage\n");
  1635. X    return;
  1636. X    }
  1637. X
  1638. X    start = sect->start;
  1639. X    end = sect->end;
  1640. X    cnt = end - start + 1;
  1641. X
  1642. X    if (debug)
  1643. X    fprintf(stderr, "Emitting a section: %d/%d(%d)\n", start, end, cnt);
  1644. X
  1645. X    fseek(file, start, 0);
  1646. X    while(cnt--)
  1647. X    putchar(getc(file));
  1648. X}
  1649. X
  1650. Xusage() {
  1651. X    fprintf(stderr,
  1652. X    "Usage: %s [-b2rc*] [-pn] [-sn] [-B|-E] [-n...] < file > file\n",
  1653. X    progname);
  1654. X}
  1655. X
  1656. Xdumppg() {
  1657. X    register int i;
  1658. X    if (!debug)
  1659. X    return;
  1660. X    fprintf(stderr, "Prolog: %d %d\n", prolog.start, prolog.end);
  1661. X    for (i = 0; i < pagecnt; i++)
  1662. X    fprintf(stderr, "%d: %d %d\n", i, pageidx[i].start, pageidx[i].end);
  1663. X    fprintf(stderr, "Epilog: %d %d\n", epilog.start, epilog.end);
  1664. X}
  1665. X
  1666. X
  1667. Xtransform() {
  1668. X    register char *p = shuffle;
  1669. X    dumppg();
  1670. X    while(*p) {
  1671. X    switch(*p++) {
  1672. X        case '2':
  1673. X        o_duplex();
  1674. X        break;
  1675. X        case 'r':
  1676. X        o_reverse();
  1677. X        break;
  1678. X        case 'b':
  1679. X        o_book();
  1680. X        break;
  1681. X        case 'p':
  1682. X        o_dupswap();
  1683. X        break;
  1684. X    }
  1685. X    }
  1686. X    dumppg();
  1687. X}
  1688. X
  1689. X/*    Make the number of pages a multiple of n,
  1690. X    by appending blank pages
  1691. X */
  1692. Xappend(n)
  1693. Xint n; {
  1694. X    while(pagecnt % n)
  1695. X    pageidx[pagecnt++] = blankpage;
  1696. X}
  1697. X
  1698. X/*    1 2 3 4 5 6 7 8 -> 1 3 5 7 ... 2 4 6 8 */
  1699. Xo_duplex() {
  1700. X    register int i, mid;
  1701. X    struct pagedesc t;
  1702. X    struct pagedesc *p;
  1703. X
  1704. X    append(2);
  1705. X
  1706. X    p = (struct pagedesc *) malloc(sizeof(struct pagedesc) * pagecnt);
  1707. X
  1708. X    mid = pagecnt / 2;
  1709. X
  1710. X    for (i = 0; i < mid; i++) {
  1711. X    p[i] = pageidx[i * 2];
  1712. X    p[i+mid] = pageidx[i * 2 + 1];
  1713. X    }
  1714. X
  1715. X    memcpy(pageidx, p, sizeof(struct pagedesc) * pagecnt);
  1716. X    free(p);
  1717. X}
  1718. X
  1719. Xo_dupswap() {
  1720. X    register int i, j;
  1721. X    struct pagedesc t;
  1722. X
  1723. X    append(2);
  1724. X
  1725. X    i = 0;
  1726. X    j = pagecnt - 1;
  1727. X
  1728. X    while(i < j) {
  1729. X    t = pageidx[i];
  1730. X    pageidx[i] = pageidx[j - 1];
  1731. X    pageidx[j - 1] = t;
  1732. X    t = pageidx[i+1];
  1733. X    pageidx[i+1] = pageidx[j];
  1734. X    pageidx[j] = t;
  1735. X    i+=2;
  1736. X    j-=2;
  1737. X    }
  1738. X}
  1739. X
  1740. Xo_reverse() {
  1741. X    register int i, j;
  1742. X    struct pagedesc t;
  1743. X
  1744. X    i = 0;
  1745. X    j = pagecnt - 1;
  1746. X
  1747. X    while(i < j) {
  1748. X    t = pageidx[i];
  1749. X    pageidx[i] = pageidx[j];
  1750. X    pageidx[j] = t;
  1751. X    i++;j--;
  1752. X    }
  1753. X}
  1754. X
  1755. Xo_book() {
  1756. X    struct pagedesc *p;
  1757. X    int i, mid, end;
  1758. X    /*  1 2 3 4 5 6 7 8 ... n -> n 1 n-2 3 n-4 5        2 n-1 4 n-3 ... */
  1759. X
  1760. X    append(4);
  1761. X
  1762. X    p = (struct pagedesc *) malloc(sizeof(struct pagedesc) * pagecnt);
  1763. X    mid = pagecnt / 2;
  1764. X    for (i = 0, end = pagecnt - 1; i < mid; i += 2, end -= 2) {
  1765. X    p[i] = pageidx[end];
  1766. X    p[i+1] = pageidx[i];
  1767. X    }
  1768. X    for (i = mid, end = pagecnt - 1; i < pagecnt; i += 2, end -= 2) {
  1769. X    p[i] = pageidx[i - mid + 1];
  1770. X    p[i+1] = pageidx[end-1];
  1771. X    }
  1772. X    memcpy(pageidx, p, sizeof(struct pagedesc) * pagecnt);
  1773. X    free(p);
  1774. X
  1775. X}
  1776. X
  1777. X/*    Read one line of file in, writing as we go to out,
  1778. X    storing the file offset of the beginning of the file
  1779. X    thru *count;
  1780. X */
  1781. X#define    CHUNK    512
  1782. Xchar *mygets(in, out, count)
  1783. XFILE *in, *out; long *count; {
  1784. X    static char *buffer = NULL;
  1785. X    static long buflimit;
  1786. X    static long curcount = 0;
  1787. X
  1788. X    register char *p;
  1789. X    register long curlength;
  1790. X    register int ch;
  1791. X    extern char *realloc();
  1792. X
  1793. X    if (count != (long *) NULL)
  1794. X    *count = curcount;
  1795. X
  1796. X    if (buffer == NULL) {
  1797. X    buffer = malloc(4096);
  1798. X    buflimit = 4096;
  1799. X    }
  1800. X
  1801. X    p = buffer;
  1802. X    while((ch = getc(in)) != EOF) {
  1803. X    putc(ch, out);
  1804. X    curcount++;
  1805. X    if (p - buffer > buflimit-3) {
  1806. X        buflimit += CHUNK;
  1807. X        buffer = realloc(buffer, buflimit);
  1808. X    }
  1809. X    *p++ = ch;
  1810. X    if (ch == '\n')
  1811. X        break;
  1812. X    }
  1813. X
  1814. X    *p = '\0';
  1815. X
  1816. X    if (p == buffer)    /* EOF */
  1817. X    return(NULL);
  1818. X    else if (buffer[0] == '\004' && !buffer[1]) {
  1819. X    needd = 1;
  1820. X    return(NULL);
  1821. X    } else
  1822. X    return(buffer);
  1823. X}
  1824. X
  1825. Xrangecmp(a, b)
  1826. Xstruct range *a, *b; {
  1827. X    if (a->start < b->start)
  1828. X    return(-1);
  1829. X    else if (a->start > b->start)
  1830. X    return(1);
  1831. X    else
  1832. X    return(0);
  1833. X}
  1834. X
  1835. Xreadranges(s)
  1836. Xchar *s; {
  1837. X    extern char *getrange();
  1838. X    register int i;
  1839. X
  1840. X    while(s && *s)
  1841. X    s = getrange(s);
  1842. X
  1843. X    /*    Internally, pages are 0 origin */
  1844. X    for (i = 0; i < ri; i++) {
  1845. X    ranges[i].start--;
  1846. X    ranges[i].end--;
  1847. X    }
  1848. X
  1849. X    qsort(ranges, ri, sizeof(struct range), rangecmp);
  1850. X}
  1851. X
  1852. Xchar *
  1853. Xgetrange(s)
  1854. Xchar *s; {
  1855. X    register char *p = s;
  1856. X    int tmp = 0;
  1857. X    ranges[ri].end = -1;
  1858. X    while (isdigit(*s))
  1859. X    tmp = 10 * tmp + (*s++ - '0');
  1860. X    if (tmp <= 0) {
  1861. X    fprintf(stderr, "%s: bad number %s\n", progname, p);
  1862. X    exit(1);
  1863. X    }
  1864. X    ranges[ri].end = ranges[ri].start = tmp;
  1865. X    if (*s == '-') {
  1866. X    s++;
  1867. X    p = s;
  1868. X    tmp = 0;
  1869. X    while(isdigit(*s))
  1870. X        tmp = 10 * tmp + (*s++ - '0');
  1871. X    if (tmp <= 0) {
  1872. X        fprintf(stderr, "%s: bad number %s\n", progname, p);
  1873. X        exit(1);
  1874. X    }
  1875. X    ranges[ri].end = tmp;
  1876. X    }
  1877. X    if (*s == ',')
  1878. X    s++;
  1879. X    ri++;
  1880. X    return(s);
  1881. X}
  1882. X
  1883. Xstripbyrange() {
  1884. X    int i, j, prevcnt = pagecnt;
  1885. X
  1886. X    if (ri == 0)
  1887. X    return;
  1888. X
  1889. X    for (i = 0; i < pagecnt; i++) {
  1890. X    for (j = 0; j < ri; j++)
  1891. X        if (i >= ranges[j].start && i <= ranges[j].end)
  1892. X        break;
  1893. X    if (j == ri)
  1894. X        pageidx[i].start = 0;
  1895. X    }
  1896. X
  1897. X    if (debug)
  1898. X    for (i = 0; i < pagecnt; i++)
  1899. X        fprintf(stderr, "SCAN: %d: %d/%d\n", i, pageidx[i].start,
  1900. X        pageidx[i].end);
  1901. X
  1902. X    for (i = 0, j = 0, prevcnt = pagecnt; i < prevcnt; i++)
  1903. X    if (pageidx[i].start != 0)
  1904. X        pageidx[j++] = pageidx[i];
  1905. X    else
  1906. X        pagecnt--;
  1907. X
  1908. X    if (debug)
  1909. X    fprintf(stderr, "%d pages deleted\n", prevcnt - pagecnt);
  1910. X}
  1911. X
  1912. Xemitnup(file, flag)
  1913. Xchar *file;
  1914. Xint flag; {
  1915. X    FILE *f;
  1916. X
  1917. X    if ((f = fopen(file, "r")) == NULL) {
  1918. X    fprintf(stderr, "%s: WOT? %s!  It was there before!\n",
  1919. X        progname, file);
  1920. X    exit(1);
  1921. X    }
  1922. X    if (flag) {
  1923. X    printf("/@#@Pages@#@ %d def\n", pages);
  1924. X    printf("/@#@Start@#@ %d def\n", startspot);
  1925. X    printf("/@#@Rev@#@ %s def\n", reversed? "true" : "false");
  1926. X    }
  1927. X
  1928. X    while(fgets(cmdbuffer, sizeof(cmdbuffer), f))
  1929. X    fputs(cmdbuffer, stdout);
  1930. X
  1931. X    fclose(f);
  1932. X}
  1933. END_OF_FILE
  1934.   if test 12922 -ne `wc -c <'utils/psxlate.c'`; then
  1935.     echo shar: \"'utils/psxlate.c'\" unpacked with wrong size!
  1936.   fi
  1937.   # end of 'utils/psxlate.c'
  1938. fi
  1939. echo shar: End of archive 7 \(of 19\).
  1940. cp /dev/null ark7isdone
  1941. MISSING=""
  1942. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; do
  1943.     if test ! -f ark${I}isdone ; then
  1944.     MISSING="${MISSING} ${I}"
  1945.     fi
  1946. done
  1947. if test "${MISSING}" = "" ; then
  1948.     echo You have unpacked all 19 archives.
  1949.     echo "Read the README to get started with psroff installation"
  1950.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1951. else
  1952.     echo You still must unpack the following archives:
  1953.     echo "        " ${MISSING}
  1954. fi
  1955. exit 0
  1956.  
  1957. exit 0 # Just in case...
  1958.